package dk.boller;


import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.core.service.IoConnector;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.transport.serial.SerialAddress;
import org.apache.mina.transport.serial.SerialConnector;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main(String[] args) throws InterruptedException {
        IoConnector ioConnector = new SerialConnector();

        SerialAddress portAddress =
                new SerialAddress("com3", 19200, SerialAddress.DataBits.DATABITS_8, SerialAddress.StopBits.BITS_1, SerialAddress.Parity.NONE, SerialAddress.FlowControl.NONE);

        ioConnector.setHandler(new IoHandlerAdapter());
        
        ConnectFuture future  = ioConnector.connect(portAddress);
        future.await();

        IoSession session = future.getSession();
    }
}
